package src; 

/**
 * The Grid Location class consists of four integers - the first two to denote a location of a subGrid on the main board, and then second pair
 * to denote a location inside of that subGrid. Used as standard indicator of location throughout game. 
 * @author Akshat
 *
 */
public class GridLocation 
{
	//location of subGrid (on mainGrid) on which play occurs
	private int mainRow; 
	private int mainCol; 
	
	//location within subGrid 
	private int subRow; 
	private int subCol; 
	
	/**
	 * @param br board row
	 * @param bc board col
	 * @param r  row
	 * @param c  col
	 */
	public GridLocation( int br, int bc, int r, int c )
	{
		mainRow = br;
		mainCol = bc; 
		subRow = r; 
		subCol = c; 
	}
	
	/**
	 * @return main row on board
	 */
	public int getMainRow()
	{
		return mainRow; 
	}
	
	/**
	 * @return main column on board 
	 */
	public int getMainCol()
	{
		return mainCol; 
	}
	
	/**
	 * @return row in subGrid
	 */
	public int getSubRow()
	{
		return subRow;
	}
	
	/**
	 * @return column in subGrid
	 */
	public int getSubCol()
	{
		return subCol; 
	}
	
	
	/**
	 * @param obj object against which to compare this location
	 */
	@Override
	public boolean equals( Object obj )
	{
		GridLocation other = (GridLocation)obj; 
		return mainRow == other.getMainRow() && mainCol == other.getMainCol() 
				&& subRow == other.getSubRow() && subCol == other.getSubCol(); 
	}
	
	@Override
	public String toString()
	{
		return( "(" + mainRow + ", " +mainCol+", "+subRow+", "+subCol+")");
	}
	
	public String networkToString()
	{
	    return (mainRow + "," + mainCol + "," + subRow + "," + subCol);
	}
}
